package com.lefeng.cockpit.resource.service;

import com.didiglobal.logi.security.common.PagingData;
import com.didiglobal.logi.security.common.Result;
import com.google.protobuf.ServiceException;
import com.lefeng.cockpit.common.bean.dto.resource.ResourceDTO;
import com.lefeng.cockpit.common.bean.po.resource.ResourcePO;

import java.io.IOException;

/**
 * resources service
 */
public interface ResourcesService {
    /**
     * create directory
     *
     * @return create directory result
     */
    Result<Object> createDirectory(ResourceDTO dto) throws ServiceException;

    /**
     * create resource
     *
     * @return create result code
     */
    Result<Object> createResource(ResourceDTO dto) throws ServiceException;

    /**
     * create resource file online
     *
     * @return create result code
     */
    Result onlineCreateResource(ResourceDTO dto) throws ServiceException;

    /**
     * updateProcessInstance resource
     *
     * @return update result cod
     */
    Result updateResourceContent(ResourceDTO dto) throws ServiceException;

    /**
     * delete resource
     *
     * @return update result cod
     */
    Result<Object> delete(int resourceId) throws IOException;

    /**
     * query resources list paging
     *
     * @return resource list page
     */
    PagingData<ResourcePO> queryResourceListPaging(ResourceDTO dto) throws ServiceException;

    /**
     * view resource file online
     *
     * @param resourceId  resource id
     * @param skipLineNum skip line number
     * @param limit       limit
     * @return resource content
     */
    Result readResource(int resourceId, int skipLineNum, int limit);

    /**
     * get tree
     *
     * @return resource content
     */
    Result getTree();
}
